---
--类名: StoryBranch.lua
--创建日期: 2016-3-29
--创建人: 陈小虎
--功能描述: 剧情分支
--修改内容:
--修改日期:   
--修改人:     
--修改备注: 
--
local StoryBranch = class("StoryBranch",function()
    return display.newLayer()
end)

function StoryBranch:ctor()

	--ui根节点
    self.mUINode = cc.uiloader:load(Res.HusongUi)
    self:addChild(self.mUINode)
    self.mUINode:setContentSize(cc.size(display.width,display.height))
    ccui.Helper:doLayout(self.mUINode)

    local function ok()
    	self:okCall()
    end
    
    local function cancel()
    	self:cancelCall()
    end

    -- local btnHusong = self.mUINode:findChild("01Bottom/03Btn_enter")
    -- local btnBattle = self.mUINode:findChild("01Bottom/04Btn_battle")
    -- local btnOk = self.mUINode:findChild("01Bottom/05Btn_ok")
    -- local btnCancel = self.mUINode:findChild("01Bottom/02Btn_back/Button_back")
    -- if btnHusong then btnHusong:setVisible(false) end
    -- if btnBattle then btnBattle:setVisible(false) end
    local battleTextNode = self.mUINode:findChild("01Bottom/note_batttle")
    local escortTextNode = self.mUINode:findChild("01Bottom/note_husong")
    battleTextNode:setVisible(false)
    escortTextNode:setVisible(false)

    local btnOk = self.mUINode:findChild("01Bottom/Button_queding")
    local btnCancel = self.mUINode:findChild("01Bottom/Button_quxiao")

    btnOk:addClickEventListener(function(sender)
    	ok()
    end)
    
    btnCancel:addClickEventListener(function(sender)
    	cancel()
    end)
end

function StoryBranch:setOkCall(call)
	self.mOkCall = call
end

function StoryBranch:setCancelCall(call)
	self.mCancelCall = call
end

function StoryBranch:okCall()
	if self.mOkCall then
		self.mOkCall()
	end
end

function StoryBranch:cancelCall()
	if self.mCancelCall then
		self.mCancelCall()
	end
end

return StoryBranch